#This script registers the SnapIn
add-pssnapin ContentFrameworkSnapIn

$env:ECF = [Environment]::GetEnvironmentVariable("ECF","Machine")


[string] $documentPath = "$args"
[string] $conversionType = "pdf"
[string] $xsltPath = [System.IO.Path]::Combine($env:ECF, "resources\HtmlConversion\xsl")
Write-Host "-----  Converting Document at  $documentPath    -----"

Convert-Document -Document "$documentPath" $xsltPath -ConversionType  $conversionType

[string] $generatedFile = [System.IO.Path]::GetFileNameWithoutExtension("$documentPath") + ".html"
Write-Host "Finished Converting Document $documentPath."
Write-Host "Converted Document is at: $generatedFile"